import Vuex from 'vuex';
import Vue from 'vue';

Vue.use(Vuex)

//this.$store.dispatch('set_x', true); 设置
//this.$store.getters.get_x 读取

const store = new Vuex.Store({

    state: {
        // 全局加载遮罩层
        baseLoadModal: 0,
        // 当前所在app信息
        currentApp: null,
        // 页面标题
        documentTitle:"",
        // 授权app列表
        appAuthList:[],
        test:"",
        systemMenu:[],
        // 应用使用历史记录
        appUseHistory:[],

    },
    mutations: {
       
        // 全局加载遮罩层
        SET_baseLoadModal(state, model) { state.baseLoadModal = model; },
        SET_currentApp(state, model) { state.currentApp = model; },
        SET_documentTitle(state, model) { state.documentTitle = model; },
        SET_appAuthList(state, model) { state.appAuthList = model; },
        SET_test(state, model) { state.test = model; },
        SET_systemMenu(state, model) { state.systemMenu = model; },
        SET_appUseHistory(state, model) { state.appUseHistory = model; },
    },
    actions: {
       
        // 全局加载遮罩层
        set_baseLoadModal({ commit }, model) { commit('SET_baseLoadModal', model); },
        set_currentApp({ commit }, model) { commit('SET_currentApp', model); },
        set_documentTitle({ commit }, model) { commit('SET_documentTitle', model); },
        set_appAuthList({ commit }, model) { commit('SET_appAuthList', model); },
        set_test({ commit }, model) { commit('SET_test', model); },
        set_systemMenu({ commit }, model) { commit('SET_systemMenu', model); },
        set_appUseHistory({ commit }, model) { commit('SET_appUseHistory', model); },
    },
    getters: {
      
        // // 全局加载遮罩层
        get_baseLoadModal: (state) => state.baseLoadModal,
        get_currentApp: (state) => state.currentApp,
        get_documentTitle: (state) => state.documentTitle,
        get_appAuthList: (state) => state.appAuthList,
        get_test: (state) => state.test,
        get_systemMenu: (state) => state.systemMenu,
        get_appUseHistory: (state) => state.appUseHistory,
    }
})
export default store;
